﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ModulesPage.Master" AutoEventWireup="true" CodeBehind="RoomBookingManagement.aspx.cs" Inherits="SwenAssignment3.RoomAvailabilityCumBookingModule.RoomBookingManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" CellSpacing="5" DataKeyNames="BookingID,RoomNo" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:CommandField ShowEditButton="True" />
                    <asp:BoundField DataField="BookingID" HeaderText="BookingID" ReadOnly="True" SortExpression="BookingID" />
                    <asp:BoundField DataField="RoomNo" HeaderText="RoomNo" ReadOnly="True" SortExpression="RoomNo" />
                    <asp:BoundField DataField="GuestID" HeaderText="GuestID" SortExpression="GuestID" />
                    <asp:BoundField DataField="DesiredCheckInDate" HeaderText="DesiredCheckInDate" SortExpression="DesiredCheckInDate" />
                    <asp:BoundField DataField="DesiredCheckOutDate" HeaderText="DesiredCheckOutDate" SortExpression="DesiredCheckOutDate" />
                    <asp:BoundField DataField="AdditionalReq" HeaderText="AdditionalReq" SortExpression="AdditionalReq" />
                    <asp:BoundField DataField="IsLateCheckOut" HeaderText="IsLateCheckOut" SortExpression="IsLateCheckOut" />
                    <asp:BoundField DataField="IsReserved" HeaderText="IsReserved" SortExpression="IsReserved" />
                    <asp:BoundField DataField="StaffID" HeaderText="StaffID" SortExpression="StaffID" />
                </Columns>
                <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                <SortedAscendingCellStyle BackColor="#FDF5AC" />
                <SortedAscendingHeaderStyle BackColor="#4D0000" />
                <SortedDescendingCellStyle BackColor="#FCF6C0" />
                <SortedDescendingHeaderStyle BackColor="#820000" />
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=USER-MSI\MSSQLSERVER2012;Initial Catalog=DRHotelDB;User ID=sa;Password=imsa" DeleteCommand="DELETE FROM [RoomBooking] WHERE [BookingID] = @BookingID AND [RoomNo] = @RoomNo" InsertCommand="INSERT INTO [RoomBooking] ([BookingID], [RoomNo], [GuestID], [DesiredCheckInDate], [DesiredCheckOutDate], [AdditionalReq], [IsLateCheckOut], [IsReserved], [StaffID]) VALUES (@BookingID, @RoomNo, @GuestID, @DesiredCheckInDate, @DesiredCheckOutDate, @AdditionalReq, @IsLateCheckOut, @IsReserved, @StaffID)" ProviderName="System.Data.SqlClient" SelectCommand="SELECT [BookingID], [RoomNo], [GuestID], [DesiredCheckInDate], [DesiredCheckOutDate], [AdditionalReq], [IsLateCheckOut], [IsReserved], [StaffID] FROM [RoomBooking] ORDER BY [DesiredCheckInDate]" UpdateCommand="UPDATE [RoomBooking] SET [GuestID] = @GuestID, [DesiredCheckInDate] = @DesiredCheckInDate, [DesiredCheckOutDate] = @DesiredCheckOutDate, [AdditionalReq] = @AdditionalReq, [IsLateCheckOut] = @IsLateCheckOut, [IsReserved] = @IsReserved, [StaffID] = @StaffID WHERE [BookingID] = @BookingID AND [RoomNo] = @RoomNo">
                <DeleteParameters>
                    <asp:Parameter Name="BookingID" Type="String" />
                    <asp:Parameter Name="RoomNo" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="BookingID" Type="String" />
                    <asp:Parameter Name="RoomNo" Type="Int32" />
                    <asp:Parameter Name="GuestID" Type="String" />
                    <asp:Parameter DbType="Date" Name="DesiredCheckInDate" />
                    <asp:Parameter DbType="Date" Name="DesiredCheckOutDate" />
                    <asp:Parameter Name="AdditionalReq" Type="String" />
                    <asp:Parameter Name="IsLateCheckOut" Type="String" />
                    <asp:Parameter Name="IsReserved" Type="String" />
                    <asp:Parameter Name="StaffID" Type="String" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="GuestID" Type="String" />
                    <asp:Parameter DbType="Date" Name="DesiredCheckInDate" />
                    <asp:Parameter DbType="Date" Name="DesiredCheckOutDate" />
                    <asp:Parameter Name="AdditionalReq" Type="String" />
                    <asp:Parameter Name="IsLateCheckOut" Type="String" />
                    <asp:Parameter Name="IsReserved" Type="String" />
                    <asp:Parameter Name="StaffID" Type="String" />
                    <asp:Parameter Name="BookingID" Type="String" />
                    <asp:Parameter Name="RoomNo" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>
            <br />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
